package org.xshop.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xshop.model.TActivity;
import org.xshop.service.ITActivityService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import top.ibase4j.core.base.BaseController;
import top.ibase4j.core.util.WebUtil;

/**
 * <p>
 * 活动  前端控制器
 * </p>
 *
 * @author ShenHuaJie
 * @since 2018-04-08
 */
@RestController
@RequestMapping("/app/activity")
@Api(value = "活动接口", description = "活动接口")
public class TActivityController extends BaseController<TActivity, ITActivityService> {
    @PostMapping(value = "getList.api")
    @ApiOperation(value = "查询活动", produces = MediaType.APPLICATION_JSON_VALUE)
    public Object query(HttpServletRequest request) {
        Map<String, Object> param = WebUtil.getParameter(request);
        Object result = service.queryAll(param);
		return setSuccessModelMap(result);
    }

    @PostMapping(value = "/detail.api")
    @ApiOperation(value = "活动详情", produces = MediaType.APPLICATION_JSON_VALUE)
    public Object get(HttpServletRequest request) {
        TActivity param = WebUtil.getParameter(request, TActivity.class);
        return super.get(param);
    }

}
